<?php
namespace AuctionCore\CarDealer;


/**
*车商功能单元测试
*@author爱民
*/
class DealerTest extends \PHPUnit_Framework_TestCase
{

	private $dealer_id = null; 
	public  static $dealer_info = array(  
		'bail_amount'=>0          //保证金总数
		,'freeze_amout'=>0        //冻结金额总数 
		,'indemnity_amount'=>0    //累计赔付金额 
		,'org_code'=>'00885000'            //车商公司编码      
		,'fullname'=>'车来车往'            //车商公司全称              
		,'shortname'=>'车来往'           //车商公司简称           
		,'type'=>''                //车商公司类型    
		,'contact_person'=>'张小小'      //联系人    
		,'contact_mobile'=>'13555555588'      //联系电话           
		,'area'=>'1'                //所在城市
		,'address'=>'2'             //通讯地址    
		,'postcode'=>'10086'            //邮编          
		,'level'=>'1'               //车商身份
		,'status'=>'1'			    //车商状态
		,'mod_man_num'=>'0'         //当月修改的提车人次数    
		,'dealer_idcard'=>''       //车商身份证     
		,'start_au_remind'=>'1'     //开始拍卖是否提醒            
		,'trading_remind'=>'0'      //交易提醒         
		,'arbitrate_remind'=>'0'    //仲裁提醒         
		,'money_change_remind'=>'0' //保证金变动提醒               

	);

	public function testCreate(){
		//创建车商
		$dealer_id = Dealer::create(self::$dealer_info);
		$this->assertTrue(intval($dealer_id)>0);

		//车商详细
		$dealer = new Dealer($dealer_id);
		$info = $dealer->dealer_base_info();
		$this->assertTrue(intval($info['dealer_id'])>0);


		//知信提醒设置
		$dealer->change_mob_msgset(2, 1);
		$msg_set = $dealer->mob_msgset_detail();
		$this->assertEquals($msg_set['trading_remind'],1);

		//删除
		$ok = Dealer::remove($dealer_id);
		$this->assertEquals($ok,1);

	}

	public function testEnableFrontUser(){
		//info [用户名，密码,昵称,密保手机号,短信手机号]
		$info = array(
			'user_name'=>'test1'
			,'passwd'=>'cccccc'
			,'nick_name'=>'爱民测试'
			,'pwd_mobile'=>'13552528384'
			,'sms_mobile'=>'13552528384'
		);
		$dealer = new Dealer(55);
		$uid = $dealer->enable_front_user($info);
		$this->assertTrue(intval($uid)>0);

	}
	


}

?>